<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>购物车</title>
</head>
<body>
	<h1>购物车</h1>
	<hr />
	<h2>购物车详细</h2>
	<table>
		<tr>
			<td>商品</td>
			<td>单价</td>
			<td>数量</td>
			<td>小计</td>
			<td>操作</td>
		</tr>
		<c:set var="basketItems" scope="page" value="${basket.items }"></c:set>
		<c:forEach var="item" items="${basketItems }">
			<tr>
				<td><img style="height: 80px; width: 80px;"
					alt="${item.product.name }"
					src="${item.product.image }" /> <a
					href="../product/get?id=${item.product.id }">${item.product.name }</a>
				</td>
				<td>${item.product.price }</td>
				<td>
					<form action="../shoppingbasket/updateitem" method="post">
						<input type="hidden" name="productId" value="${item.product.id }" />
						<input type="text" name="quantity" value="${item.quantity }" />
						<input type="submit" value="更新" />
					</form>
				</td>
				<td>${item.product.price * item.quantity }</td>
				<td><a
					href="../shoppingbasket/removeitem?productId=${item.product.id }">删除</a></td>
			</tr>
		</c:forEach>

	</table>

	<hr />
	<a href="../home">返回</a>
</body>
</html>